import 'package:json_annotation/json_annotation.dart';

part 'home_list_bean.g.dart';

@JsonSerializable()
class HomeListBean {
  String weather;
  String xianxing;
  List<ArticlesListBean> articles;
  List<BannersListBean> banners;
  List<NavigationsListBean> navigations;

  HomeListBean(
      {this.weather,
      this.xianxing,
      this.articles,
      this.banners,
      this.navigations});

  HomeListBean.fromJson(Map<String, dynamic> json) {
    this.weather = json['weather'];
    this.xianxing = json['xianxing'];
    this.articles = (json['articles'] as List) != null
        ? (json['articles'] as List)
            .map((i) => ArticlesListBean.fromJson(i))
            .toList()
        : null;
    this.banners = (json['banners'] as List) != null
        ? (json['banners'] as List)
            .map((i) => BannersListBean.fromJson(i))
            .toList()
        : null;
    this.navigations = (json['navigations'] as List) != null
        ? (json['navigations'] as List)
            .map((i) => NavigationsListBean.fromJson(i))
            .toList()
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['weather'] = this.weather;
    data['xianxing'] = this.xianxing;
    data['articles'] = this.articles != null
        ? this.articles.map((i) => i.toJson()).toList()
        : null;
    data['banners'] = this.banners != null
        ? this.banners.map((i) => i.toJson()).toList()
        : null;
    data['navigations'] = this.navigations != null
        ? this.navigations.map((i) => i.toJson()).toList()
        : null;
    return data;
  }
}

class ArticlesListBean {
  String summary;
  String createTime;
  String author;
  String headPic;
  String title;
  String videoUrl;
  String name;
  String id;
  String labelId;
  int click;
  int good;
  int hasVideo;
  int isTop;
  int comment;
  int sn;
  int status;
  int order;

  ArticlesListBean(
      {this.summary,
      this.createTime,
      this.author,
      this.headPic,
      this.title,
      this.videoUrl,
      this.name,
      this.id,
      this.labelId,
      this.click,
      this.good,
      this.hasVideo,
      this.isTop,
      this.comment,
      this.sn,
      this.status,
      this.order});

  ArticlesListBean.fromJson(Map<String, dynamic> json) {
    this.summary = json['summary'];
    this.createTime = json['create_time'];
    this.author = json['author'];
    this.headPic = json['head_pic'];
    this.title = json['title'];
    this.videoUrl = json['video_url'];
    this.name = json['name'];
    this.id = json['id'];
    this.labelId = json['label_id'];
    this.click = json['click'];
    this.good = json['good'];
    this.hasVideo = json['has_video'];
    this.isTop = json['is_top'];
    this.comment = json['comment'];
    this.sn = json['sn'];
    this.status = json['status'];
    this.order = json['order'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['summary'] = this.summary;
    data['create_time'] = this.createTime;
    data['author'] = this.author;
    data['head_pic'] = this.headPic;
    data['title'] = this.title;
    data['video_url'] = this.videoUrl;
    data['name'] = this.name;
    data['id'] = this.id;
    data['label_id'] = this.labelId;
    data['click'] = this.click;
    data['good'] = this.good;
    data['has_video'] = this.hasVideo;
    data['is_top'] = this.isTop;
    data['comment'] = this.comment;
    data['sn'] = this.sn;
    data['status'] = this.status;
    data['order'] = this.order;
    return data;
  }
}

class BannersListBean {
  String id;
  String pic;
  String redirectUrl;

  BannersListBean({this.id, this.pic, this.redirectUrl});

  BannersListBean.fromJson(Map<String, dynamic> json) {
    this.id = json['id'];
    this.pic = json['pic'];
    this.redirectUrl = json['redirect_url'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['pic'] = this.pic;
    data['redirect_url'] = this.redirectUrl;
    return data;
  }
}

class NavigationsListBean {
  String levelName;
  String parentId;
  String id;
  String pic;
  String title;
  String redirectUrl;
  int serviceType;
  int sort;
  int homeEntrance;
  int click;
  int status;

  NavigationsListBean(
      {this.levelName,
      this.parentId,
      this.id,
      this.pic,
      this.title,
      this.redirectUrl,
      this.serviceType,
      this.sort,
      this.homeEntrance,
      this.click,
      this.status});

  NavigationsListBean.fromJson(Map<String, dynamic> json) {
    this.levelName = json['level_name'];
    this.parentId = json['parent_id'];
    this.id = json['id'];
    this.pic = json['pic'];
    this.title = json['title'];
    this.redirectUrl = json['redirect_url'];
    this.serviceType = json['service_type'];
    this.sort = json['sort'];
    this.homeEntrance = json['home_entrance'];
    this.click = json['click'];
    this.status = json['status'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['level_name'] = this.levelName;
    data['parent_id'] = this.parentId;
    data['id'] = this.id;
    data['pic'] = this.pic;
    data['title'] = this.title;
    data['redirect_url'] = this.redirectUrl;
    data['service_type'] = this.serviceType;
    data['sort'] = this.sort;
    data['home_entrance'] = this.homeEntrance;
    data['click'] = this.click;
    data['status'] = this.status;
    return data;
  }
}
